{% extends 'index.html' %}

{% block body %}
    {% if dao %}
<h3 ><strong>DATI PRIMA NOTA</strong></h3>
<table style="width:auto;">
<th style="width:70px;">NUMERO</th>
<th style="width:90px;">DATA</th>
<tr>
<td style="width:70px;text-align:center;"><strong>{{dao.numero}}</strong></td>
<td style="width:90px;text-align:center;"><strong>{{utils.dateToString(dao.data_inizio)}}</strong></td>
</tr>
</table>
{% if dao.righeprimanota|length >1 %}
<p><b>DESCRIZIONE: </b> {{dao.note|nonone}}</p>
{% endif %}

    <table cellpadding="0" cellspacing="0" border="0">
        <th><b>DESCRIZIONE</b></th>
        <th ><b>VALORE</b></th>
        <th><b>TIPO</b></th>
        <th><b>RIF.</b></th>
	<th><b>NOTE</b></th>

        {% for riga in dao.righeprimanota %}
        <tr >
            <td class="odd-detail">{{riga.denominazione|replace("\\n"," ")}}</td>
            {% if riga.segno =="entrata" %}
                <td style="color:green;width:80px;text-align:center;" class="odd-detail">{{utils.mNLC(riga.valore,2)}}</td>
            {% elif riga.segno =="uscita" %}
            <td style="color:red;width:80px;text-align:center;" class="odd-detail">-{{utils.mNLC(riga.valore,2)}}</td>
            {% endif %}
            {% if riga.tipo =="banca" %}
                <td style="color:blue;width:80px;text-align:center;" class="odd-detail">{{(riga.tipo)}}</td>
            {% elif riga.tipo =="cassa" %}
            <td style="color:orange;width:80px;text-align:center;" class="odd-detail">{{riga.tipo}}</td>
            {% endif %}
              <td style="width:12%;" class="odd-detail">{{riga.banca[0:30]}}</td>
	      <td class="odd-detail">{{ riga.note_primanota|nonone }}</td>
        </tr>
        {% endfor %}
        {% if dao.righeprimanota|length==1 %}
<tr> <td span=4><br />NOTE: {{dao.note|nonone}}</td></tr>
{% endif %}
                </table>
<br />
<table style="width:280px;">
<tr>
        <td style="width:100px;"><b>TOTALE ENTRATE CASSA</b></td>
<td style="color:green;width:70px;" >{{utils.mNLC(dao.totali["tot_entrate_cassa"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>TOTALE USCITE CASSA</b></td>
        <td style="color:red;width:70px;">{{utils.mNLC(dao.totali["tot_uscite_cassa"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>TOTALE ENTRATE BANCA</b></td>
        <td style="color:green;width:70px;">{{utils.mNLC(dao.totali["tot_entrate_banca"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>TOTALE USCITE BANCA</b></td>
        <td style="color:red;width:70px;">{{utils.mNLC(dao.totali["tot_uscite_banca"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>TOTALE ENTRATE</b></td>
        <td style="color:green;width:70px;">{{utils.mNLC(dao.totali["tot_entrate"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>TOTALE USCITE</b></td>
        <td style="color:red;width:70px;">{{utils.mNLC(dao.totali["tot_uscite"],2)}}</td>
</tr>
<tr>
        <td style="width:100px;"><b>SALDO</b></td>
        {% if dao.totali["totale"] > 0 %}
        <td style="color:green;width:70px;"><b>{{utils.mNLC(dao.totali["totale"],2)}}</b></td>
        {% else %}
        <td style="color:red;width:70px;" ><b>{{utils.mNLC(dao.totali["totale"],2)}}</b></td>
         {% endif %}
</tr>
</table>
        {% else %}
        <p><img src= "gui/attenzione_48X48.png">ELIMINATO: Niente da visualizzare</p>
        <p><img src= "gui/testata_promogest2.png"></p>
        {% endif %}


{% endblock %}
